Skip to content

Conversation

Strift
Copy link
Contributor

@Strift Strift commented Aug 20, 2025

Fix Meilisearch 1.18 tests run

Summary by CodeRabbit

  • Tests
    • Relaxed assertions to verify inclusion rather than exact array equality for swap-related task details, making tests resilient to order changes and additional entries.
    • Improves test robustness and reduces flakiness without altering runtime behavior.
    • No user-facing changes or feature impacts.

Copy link

coderabbitai bot commented Aug 20, 2025

Walkthrough

Test updated in spec/meilisearch/client/indexes_spec.rb: assertion changed from strict array equality to inclusion-based checks for swap entries, allowing order-insensitive matching and extra entries while verifying presence of two specific swap index pairs.

Changes

Cohort / File(s) Change Summary
Test assertion update
spec/meilisearch/client/indexes_spec.rb
Replaced exact equality assertion on task['details']['swaps'] with inclusion-based checks for two expected swap objects; now order-insensitive and tolerant of additional entries.

Sequence Diagram(s)

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

A rabbit taps tests with delicate paws,
Loosening equality’s stringent laws.
“Include, not equal,” I cheerfully say,
Let extras parade in orderly sway.
Two swaps found—hip hop hooray!
Burrow secured for another day. 🐇✨

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/fix-tests-after-v1.18

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@Strift Strift requested a review from a team August 20, 2025 05:08
@Strift Strift added the maintenance Anything related to maintenance (CI, tests, refactoring...) label Aug 20, 2025
Copy link

codecov bot commented Aug 20, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (1091577) to head (0aaeae9).

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #645   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           10        10           
  Lines          806       806           
=========================================
  Hits           806       806           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
spec/meilisearch/client/indexes_spec.rb (2)

271-274: Make the pair-level check order-agnostic as well

As written, the inner arrays for 'indexes' must match in the exact order (['indexA', 'indexB'] vs ['indexB', 'indexA']). If the API returns pairs in a different order, this will still fail. Use match_array to allow either order within each pair.

Suggested change:

-      expect(task['details']['swaps']).to include(
-        include('indexes' => ['indexA', 'indexB']),
-        include('indexes' => ['indexC', 'indexD'])
-      )
+      expect(task['details']['swaps']).to include(
+        include('indexes' => match_array(%w[indexA indexB])),
+        include('indexes' => match_array(%w[indexC indexD]))
+      )

271-274: Optional: pre-assert the shape for clearer failures

Adding a couple of light-weight assertions improves failure messages when the API payload changes.

-      expect(task['details']['swaps']).to include(
+      expect(task['details']).to include('swaps')
+      expect(task['details']['swaps']).to be_an(Array)
+      expect(task['details']['swaps']).to include(
         include('indexes' => ['indexA', 'indexB']),
         include('indexes' => ['indexC', 'indexD'])
       )
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 1091577 and 0aaeae9.

📒 Files selected for processing (1)
  • spec/meilisearch/client/indexes_spec.rb (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
spec/meilisearch/client/indexes_spec.rb (2)
lib/meilisearch/client.rb (1)
  • task (424-426)
lib/meilisearch/task.rb (1)
  • task (19-21)
🔇 Additional comments (1)
spec/meilisearch/client/indexes_spec.rb (1)

271-274: Good call making the swaps assertion permissive to reduce test brittleness

Switching to inclusion-based checks makes the test resilient to ordering and any extra swap entries returned by the API. This should help stabilize the suite across Meilisearch versions.

@Nymuxyzo Nymuxyzo mentioned this pull request Aug 20, 2025
3 tasks
Copy link
Member

@curquiza curquiza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bors merge

Copy link
Contributor

meili-bors bot commented Aug 21, 2025

Build succeeded:

@meili-bors meili-bors bot merged commit 78f93e6 into main Aug 21, 2025
9 checks passed
@meili-bors meili-bors bot deleted the chore/fix-tests-after-v1.18 branch August 21, 2025 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintenance Anything related to maintenance (CI, tests, refactoring...)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants